import {
  IsEmail,
  IsString,
  MinLength,
  IsOptional,
  IsIn,
  Matches,
} from 'class-validator';

export class CreateUserDto {
  @IsOptional()
  @IsEmail()
  email?: string;

  @IsOptional()
  @Matches(/^1[3-9]\d{9}$/, { message: '手机号格式不正确' })
  phone?: string;

  @IsString()
  @MinLength(2)
  nickname: string;

  @IsString()
  @IsIn(['男', '女', '保密'])
  gender: string;

  @IsString()
  @MinLength(6)
  password: string;
}
